<?php
	// If Process type is PREVIEW/EDIT/DELETE, Get All variables needed to be displayed by form, Edit SQL & Variable if necessary !!!
	if($process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE")
	{
		$sql2 = "select * from ms_file where stsrc = 'A' and filerole = 'image' and fileid = '".$PK_id."' ";
		$exe2 = mysql_query($sql2) or die(mysql_error());
		$num2 = mysql_num_rows($exe2);
		$row2 = mysql_fetch_array($exe2);
		
		// Set Value if data is found
		if($num2>0)
		{
			$val_image_PK_id = $row2['fileid'];
			$val_image_name = $row2['filename'];
			$val_image_label = $row2['filelabel'];
			$val_image_size = $row2['filesize'];
			$val_image_type = $row2['filetype'];
			$val_image_role = $row2['filerole'];
			$val_image_url = $row2['fileurl'];
			$val_image_position = $row2['fileposition'];
			$val_image_activate = $row2['filestatus'];
		}
		else
		{
			$val_image_PK_id = "";
			$val_image_name = "";
			$val_image_label = "";
			$val_image_size = "";
			$val_image_type = "";
			$val_image_role = "";
			$val_image_url = "";
			$val_image_position = "";
			$val_image_activate = "";
		}
	}
	else
	{
		$val_image_PK_id = "";
		$val_image_name = "";
		$val_image_label = "";
		$val_image_size = "";
		$val_image_type = "";
		$val_image_role = "";
		$val_image_url = "";
		$val_image_position = "";
		$val_image_activate = "";
	}
	
?>
<!-- Start Row Data -->
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">File</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" type="text" name="txt_image_name" value="<?php echo $val_image_name; ?>" />
		<input <?php if($_SESSION['usergroupid'] != 1 || $process_type == "PREVIEW" || $process_type == "EDIT" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_image_name" value="<?php echo $val_image_name; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Preview</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<img src="<?php echo $val_image_url; ?>" style="max-width:200px; max-height:100px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Label</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="text" required name="txt_image_label" value="<?php echo $val_image_label; ?>" style="width:200px; height:18px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Position</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="number" required min="1" max="100" name="txt_image_position" value="1" style="width:50px; height:18px; font-size:10px;" />
	</div>
	<div style="clear:both;"></div>
</div>
<div class="divFormRowData">
	<div style="float:left; text-align:right; width:<?php echo $rowDivWidth; ?>px;">Activate</div>
	<div style="float:left;">&nbsp;:&nbsp;</div>
	<div style="float:left;">
		<input type="hidden" name="txt_image_PK_id" value="<?php echo $val_image_PK_id; ?>" style="width:200px; height:18px;" />
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_image_activate" value="1" <?php if(isset($val_image_activate)){if($val_image_activate == 1){echo "checked='true'";}} ?> /> Yes
		<input <?php if($process_type == "PREVIEW" || $process_type == "DELETE"){echo "disabled='disabled'";} ?> type="radio" name="rdo_image_activate" value="0" <?php if(isset($val_image_activate)){if($val_image_activate == 0){echo "checked='true'";}} ?> /> No
	</div>
	<div style="clear:both;"></div>
</div>
<!-- End Row Data -->